import request from '@/utils/request'

/** -------------------停车区域相关请求函数-------------------- */
/**
 * 查看停车区域列表
 *
 * @param { page, pageSize } params
 *
 * @returns {Promise}
 */
export function getAreaListAPI(params) {
  return request({
    url: '/parking/area/list',
    method: 'get',
    params
  })
}

/**
 * 添加停车区域
 *
 * @param { areaName, spaceNumber, areaProportion, ruleId, remark } data
 *
 * @returns {Promise}
 */
export function addAreaAPI(data) {
  return request({
    url: '/parking/area',
    method: 'post',
    data
  })
}

/**
 * 编辑停车区域
 *
 * @param { id, areaName, spaceNumber, areaProportion, ruleId, remark } data
 *
 * @returns {Promise}
 */
export function editAreaAPI(data) {
  return request({
    url: '/parking/area',
    method: 'put',
    data
  })
}

/**
 * 删除停车区域
 *
 * @param { String } id
 *
 * @returns {Promise}
 */
export function deleteAreaAPI(id) {
  return request({
    url: `/parking/area/${id}`,
    method: 'delete'
  })
}

/**
 * 获取关联区域下拉列表
 *
 * @returns {Promise}
 */
export function getAreaSelectListAPI() {
  return request({
    url: '/parking/area/dropList',
    method: 'get'
  })
}
